package com.example.ssd4.domain;

import javafx.geometry.HPos;
import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.text.TextAlignment;

public class LessonLbl extends Label {
    public LessonLbl(Lesson lesson,int day){
        setText(lesson.getName() + "\n" + lesson.getTeacher());
        setWrapText(true);
        setAlignment(Pos.CENTER);
        setTextAlignment(TextAlignment.CENTER);

        GridPane.setHalignment(this, HPos.CENTER);
        GridPane.setValignment(this, VPos.CENTER);

        setMinWidth(100);
        setMaxWidth(100);
        setMinHeight(68);
        setMaxHeight(68);

        String colorStr = null;

        switch (day){
            case 1: case 7:
                colorStr = "#1ba0ce";break;
            case 2:
                colorStr = "#00b0ec";break;
            case 3:
                colorStr = "#fccb00";break;
            case 4:
                colorStr = "#ff8d44";break;
            case 5:
                colorStr = "#ff7372";break;
            case 6:
                colorStr = "#6349cd";break;
        }

        setStyle("-fx-background-color: " + colorStr + "; " +
                "-fx-background-radius: 12; " +     // 背景圆角的半径
                "-fx-padding: 10;" +
                "-fx-text-fill: white;");

        setOnMouseClicked(mouseEvent -> {

        });
    }
}
